<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style type="text/css">
    html,body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;

      display: flex;
      align-items: center;
      justify-content: center;
    }

    #demo {
      width: 300px;
      height: 300px;
      border: 1px solid #999;
      background-color: beige;
      margin: 0 auto;
      /* position: relative;
      top: 50%;
      transform: translateY(-50%);
    } */

    img {
      height: 100px;
      width: 100px;
      /* 图片居中 */
      vertical-align: middle;
    }
  </style>
</head>

<body>
  <div id="demo">
  </div>
</body>

</html>